<template>
<div class="">
    <div class="pr10">
        <div class="analyItem">
            <p class="analyItemTit tx-center">状态</p>
            <div class="analyItemCon">

            </div>
        </div>
    </div>
    <div class="thinScroll pr10" v-scrollHeight="10">
        <router-link tag="div" :to="{path:routerPath('meetingProductionmeeting'),query:{productionMeeting:productionMeeting}}" class="analyItem anItemBor" active-class="anItemBor-active">
            <p class="analyItemTit tx-center">生产会</p>
            <div class="analyItemCon">
                <span class="circlemark circlemark-yellow" v-if="productionMeeting.timeDiff<0">待</span>
                <span class="circlemark" v-else :class="{'circlemark-green':productionMeeting.meetingLevel==4,'circlemark-lightGreen':productionMeeting.meetingLevel==3,'circlemark-yellow':productionMeeting.meetingLevel==2,'circlemark-lightRed':productionMeeting.meetingLevel==1}">{{productionMeeting.meetingLevel|meetingLevel}}</span>
            </div>
        </router-link>
        <router-link tag="div" :to="{path:routerPath('meetingEngineeringmeeting'),query:{engineeringMeeting:engineeringMeeting}}" class="analyItem anItemBor" active-class="anItemBor-active">
            <p class="analyItemTit tx-center">工程会</p>
            <div class="analyItemCon">
                <span class="circlemark circlemark-yellow" v-if="engineeringMeeting.timeDiff<0">待</span>
                <span class="circlemark" v-else :class="{'circlemark-green':engineeringMeeting.meetingLevel==4,'circlemark-lightGreen':engineeringMeeting.meetingLevel==3,'circlemark-yellow':engineeringMeeting.meetingLevel==2,'circlemark-lightRed':engineeringMeeting.meetingLevel==1}">{{engineeringMeeting.meetingLevel|meetingLevel}}</span>
            </div>
        </router-link>
    </div>
    <!-- <div class="pr10">
        <router-link tag="div" :to="routerPath('meetingProcessing')" class="analyItem anItemBor" active-class="anItemBor-active">
            <p class="analyItemTit tx-center">处理</p>
            <div class="analyItemCon">

            </div>
        </router-link>
    </div> -->
</div>
</template>
<script>
import {mapGetters} from 'vuex'
import {whetherWaitByRegion} from '../Resources/Api'
export default {
    data () {
        return {
            productionMeeting: {},
            engineeringMeeting: {}
        }
    },
    computed: {
        ...mapGetters(['leftInfo'])
    },
    created () {
        this.whetherWaitByRegion()
    },
    filters: {
        meetingLevel (value) {
            let result
            switch (value) {
            case 4:
                result = '优'
                break
            case 3:
                result = '良'
                break
            case 2:
                result = '中'
                break
            case 1:
                result = '差'
                break
            default:
                break
            }
            return result
        }
    },
    methods: {
        whetherWaitByRegion () {
            whetherWaitByRegion({
                region: this.leftInfo.u_diqu
            }).then(results => {
                let array = results.data.Body
                array.forEach(element => {
                    if (element.meetingTypeName === '工生') {
                        this.productionMeeting = element
                    } else if (element.meetingTypeName === '工') {
                        this.engineeringMeeting = element
                    }
                })
            })
        },
        // 路由跳转路径拼接
        routerPath (path) {
            return this.$route.matched[1].path + '/' + path
        },
        // 直接进行路由跳转路径
        routerPush (path) {
            this.$router.push(this.$route.matched[1].path + '/' + path)
        }
    },
    watch: {
        leftInfo () {
            this.whetherWaitByRegion()
        }
    }
}
</script>
